This file is part of the supplementary material of the manuscript: Didino, D., Brandtner, M., & Knops, A. (2021). No influence of masked priming on the multiplication fact retrieval in a result verification task.
This script analyzes the Forced-choice prime detection task of experiment 3. The analysis is based on both accuracy and d’ (see function return_d_prime for the formula used to calculate it).
Dataset loaded: exp_soa_2_data_PDT.csv (data of forced-choice prime detection tasks (PDT))
Load libraries and data:
library('tidyverse')
#> -- Attaching packages --------------------------------------- tidyverse 1.3.1 --
#> v ggplot2 3.3.5 v purrr 0.3.4
#> v tibble 3.1.0 v dplyr 1.0.5
#> v tidyr 1.1.3 v stringr 1.4.0
#> v readr 1.4.0 v forcats 0.5.1
#> -- Conflicts ------------------------------------------ tidyverse_conflicts() --
#> x dplyr::filter() masks stats::filter()
#> x dplyr::lag() masks stats::lag()
library('here')
#> here() starts at D:/mult_prime
library('janitor')
#>
#> Attaching package: 'janitor'
#> The following objects are masked from 'package:stats':
#>
#> chisq.test, fisher.test
library('plotly')
#>
#> Attaching package: 'plotly'
#> The following object is masked from 'package:ggplot2':
#>
#> last_plot
#> The following object is masked from 'package:stats':
#>
#> filter
#> The following object is masked from 'package:graphics':
#>
#> layout
library('ggpubr')
# library('knitr')
library('kableExtra')
#>
#> Attaching package: 'kableExtra'
#> The following object is masked from 'package:dplyr':
#>
#> group_rows
library('BayesFactor')
#> Loading required package: coda
#> Loading required package: Matrix
#>
#> Attaching package: 'Matrix'
#> The following objects are masked from 'package:tidyr':
#>
#> expand, pack, unpack
#> ************
#> Welcome to BayesFactor 0.9.12-4.2. If you have questions, please contact Richard Morey (richarddmorey@gmail.com).
#>
#> Type BFManual() to open the manual.
#> ************
# Load my functions
source(here('funcs', 'load_my_functions.R'))
# Load data
exp3_pdt <- read_csv(here('data', 'rawdata', 'exp_soa_2_data_PDT.csv'))
#>
#> -- Column specification --------------------------------------------------------
#> cols(
#> sj = col_character(),
#> age = col_double(),
#> gender = col_character(),
#> op1 = col_double(),
#> op2 = col_double(),
#> probe = col_double(),
#> product = col_double(),
#> prime = col_double(),
#> filler = col_double(),
#> probe_type = col_character(),
#> prime_type = col_character(),
#> SOA = col_character(),
#> acc = col_double(),
#> RT = col_double(),
#> block = col_double(),
#> problem_size = col_character(),
#> timing = col_character()
#> )
Select the same participants included in the analysis on RT for the result verification task.
exp3_pdt_sj <-
exp3_pdt %>%
filter(!(sj %in% c('sj27')))
Plot RT (across sj, accuracy and SOA)
exp3_pdt_sj %>%
mutate(acc = as.factor(acc)) %>%
ggplot(data = .) +
geom_boxplot(
mapping = aes(x = sj, y = RT)
) +
geom_point(
mapping = aes(x = sj, y = RT, colour = acc),
position = position_dodge(0.9, preserve = 'total'),
shape = 1
) +
facet_wrap(~SOA, nrow = 3)
#> Warning: Removed 66 rows containing non-finite values (stat_boxplot).
#> Warning: Removed 66 rows containing missing values (geom_point).
Plot accuracy by SOA and subject
plot_PVT <-
exp3_pdt_sj %>%
group_by(sj, SOA) %>%
summarise(acc = mean(acc)) %>%
ungroup() %>%
ggplot(aes(x = acc, y = sj, colour = SOA)) +
geom_point(position = position_dodge(0.5, preserve = 'total')) +
coord_cartesian(xlim = c(0, 1)) +
geom_vline(xintercept = c(0.4, 0.5, 0.6),
linetype = 'dashed',
color = c('grey', 'black', 'grey'),
size = 0.5)
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
ggplotly(plot_PVT)
Tables are created with the my function return_info()
tb <-
return_info(exp3_pdt_sj)
tb$gender
| gender | n | percent |
|---|---|---|
| female | 17 | 58.62 |
| male | 12 | 41.38 |
tb$age
| mean | sd | min | max |
|---|---|---|---|
| 27.52 | 6.21 | 18 | 39 |
tb$error
| N_error | N_trial | percent_error |
|---|---|---|
| 2383 | 5220 | 45.65 |
tb$omitted
| N_omitted | N_trial | percent_omitted |
|---|---|---|
| 66 | 5220 | 1.26 |
tb$timing
| N_wrong_timing | N_trial | percent_wrong_timing |
|---|---|---|
| 0 | 5220 | 0 |
tb$less_200
| N_less_200 | N_trial | percent_less_200 |
|---|---|---|
| 388 | 5220 | 7.43 |
Calculate statistics for accuracy (across SOA, prime type, and probe type)
exp3_pdt_sj %>%
return_stats(c('SOA', 'prime_type', 'probe_type'), DV = 'acc') %>%
make_table('Accuracy')
#> `summarise()` has grouped output by 'sj', 'SOA', 'prime_type'. You can override using the `.groups` argument.
#> `summarise()` has grouped output by 'SOA', 'prime_type'. You can override using the `.groups` argument.
| SOA | prime_type | probe_type | N_sj | Mean | SD | SE |
|---|---|---|---|---|---|---|
| SOA_050 | letter | not_product | 29 | 0.67 | 0.24 | 0.04 |
| SOA_050 | letter | product | 29 | 0.65 | 0.23 | 0.04 |
| SOA_050 | number | not_product | 29 | 0.48 | 0.27 | 0.05 |
| SOA_050 | number | product | 29 | 0.46 | 0.26 | 0.05 |
| SOA_170 | letter | not_product | 29 | 0.71 | 0.24 | 0.04 |
| SOA_170 | letter | product | 29 | 0.69 | 0.22 | 0.04 |
| SOA_170 | number | not_product | 29 | 0.34 | 0.22 | 0.04 |
| SOA_170 | number | product | 29 | 0.37 | 0.22 | 0.04 |
| SOA_220 | letter | not_product | 29 | 0.73 | 0.25 | 0.05 |
| SOA_220 | letter | product | 29 | 0.74 | 0.23 | 0.04 |
| SOA_220 | number | not_product | 29 | 0.35 | 0.23 | 0.04 |
| SOA_220 | number | product | 29 | 0.34 | 0.23 | 0.04 |
Plot accuracy by SOA
plot_acc_soa_OLD <-
exp3_pdt_sj %>%
group_by(sj, SOA) %>%
summarise(acc = mean(acc)) %>%
ungroup() %>%
ggplot(aes(x = SOA, y = acc, fill = SOA)) +
geom_flat_violin(position = position_nudge(x = 0.1, y = 0),
adjust = 1.5,
trim = TRUE,
alpha = .5,
colour = NA) +
geom_point(aes(x = as.numeric(factor(SOA)) - 0.15, y = acc, colour = SOA),
position = position_jitter(width = 0.05, height = 0),
size = 2,
shape = 20) +
geom_boxplot(outlier.shape = NA,
alpha = 0.5,
width = 0.1,
colour = "black") +
guides(fill = 'none') +
guides(color = 'none') +
scale_colour_brewer(palette = 'Dark2') +
scale_fill_brewer(palette = 'Dark2') +
geom_hline(yintercept = 0.5,
linetype = 'dashed',
color = 'red',
size = 0.3)
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
plot_acc_soa_OLD
plot_acc_soa <-
exp3_pdt_sj %>%
group_by(sj, SOA) %>%
summarise(acc = mean(acc)) %>%
ungroup() %>%
ggplot(aes(x = SOA, y = acc, fill = SOA)) +
geom_boxplot(outlier.shape = NA,
width = 0.2) +
geom_point(aes(x = as.numeric(factor(SOA)) - 0.25, y = acc, colour = SOA),
position = position_jitter(width = 0.05, height = 0),
size = 2,
colour = "gray40",
shape = 20) +
labs(x = 'SOA', y = 'Accuracy') +
# ylim(0, 1) +
guides(fill = 'none') +
guides(color = 'none') +
scale_fill_manual(values = c('gray70', 'gray70', 'gray70')) +
scale_color_manual(values = c('gray70', 'gray70', 'gray70')) +
theme(
#panel.grid.major = element_blank(),
#panel.grid.minor = element_blank(),
panel.background = element_blank(),
panel.grid.major.y = element_line(colour = 'grey90'),
panel.grid.minor.y = element_line(colour = 'grey90'),
panel.grid.major.x = element_blank(),
panel.grid.minor.x = element_blank(),
strip.background = element_blank(),
text = element_text(size = 12),
axis.text = element_text(size = 10, colour = 'black'),
# axis.text.x = element_text(angle = 45, hjust = 1),
# axis.title = element_text(size = 14),
panel.border = element_rect(colour = 'black', fill = NA, size = 0.5)
)
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
plot_acc_soa
Calculate accuracy mean by participant and SOA
exp3_pdt_mean_acc <-
exp3_pdt_sj %>%
return_means(acc, c('sj', 'SOA'), .)
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
Compute Bayes factors
exp3_pdt_bf <-
exp3_pdt_mean_acc %>%
group_by(SOA) %>%
nest() %>%
mutate(
BF_test = map(data,
~ttestBF(x = .x$DV,
mu = 0.5)),
BF_value = map(BF_test,
~extractBF(.) %>%
tibble %>%
select(bf, error))
) %>%
unnest(BF_value)
Calculate statistics for accuracy
exp3_pdt_stats <-
exp3_pdt_sj %>%
return_stats(c('SOA'), DV = 'acc')
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
Table with accuracy mean, standard deviation and standard error (aggregated on subject, and SOA), and Bayes factors:
exp3_table3 <-
full_join(
exp3_pdt_stats %>%
mutate(across(where(is.numeric), ~round(.x, digits = 3))),
exp3_pdt_bf %>%
select(SOA, bf) %>%
rename(BF_10 = bf) %>%
mutate(across(where(is.numeric), ~signif(.x, 1))))
#> Joining, by = "SOA"
# Show results
exp3_table3 %>%
make_table('Accuracy and Bayes factor (across SOA)')
| SOA | N_sj | Mean | SD | SE | BF_10 |
|---|---|---|---|---|---|
| SOA_050 | 29 | 0.56 | 0.11 | 0.02 | 10.0 |
| SOA_170 | 29 | 0.53 | 0.08 | 0.01 | 0.7 |
| SOA_220 | 29 | 0.54 | 0.10 | 0.02 | 1.0 |
The d’ is calculated for each subject and each SOA (SOA_220, SOA_170, SOA_050)
# Calculate d'
d_prime <-
exp3_pdt_sj %>%
return_d_prime()
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
# Print the results in csv and txt files
d_prime %>%
make_table('d prime (and statistics used to calculate it) across subjects')
| sj | SOA | n_letter | n_number | hit | false_al | hr | fr | z_hr | z_fr | d_prime |
|---|---|---|---|---|---|---|---|---|---|---|
| sj01 | SOA_050 | 30 | 30 | 25 | 11 | 0.83 | 0.37 | 0.97 | -0.34 | 1.31 |
| sj01 | SOA_170 | 30 | 30 | 12 | 4 | 0.40 | 0.13 | -0.25 | -1.11 | 0.86 |
| sj01 | SOA_220 | 30 | 30 | 8 | 6 | 0.27 | 0.20 | -0.62 | -0.84 | 0.22 |
| sj02 | SOA_050 | 30 | 30 | 16 | 6 | 0.53 | 0.20 | 0.08 | -0.84 | 0.93 |
| sj02 | SOA_170 | 30 | 30 | 12 | 6 | 0.40 | 0.20 | -0.25 | -0.84 | 0.59 |
| sj02 | SOA_220 | 30 | 30 | 9 | 7 | 0.30 | 0.23 | -0.52 | -0.73 | 0.20 |
| sj03 | SOA_050 | 30 | 30 | 13 | 30 | 0.43 | 1.00 | -0.17 | Inf | -Inf |
| sj03 | SOA_170 | 30 | 30 | 17 | 30 | 0.57 | 1.00 | 0.17 | Inf | -Inf |
| sj03 | SOA_220 | 30 | 30 | 7 | 30 | 0.23 | 1.00 | -0.73 | Inf | -Inf |
| sj04 | SOA_050 | 30 | 30 | 20 | 13 | 0.67 | 0.43 | 0.43 | -0.17 | 0.60 |
| sj04 | SOA_170 | 30 | 30 | 11 | 13 | 0.37 | 0.43 | -0.34 | -0.17 | -0.17 |
| sj04 | SOA_220 | 30 | 30 | 14 | 4 | 0.47 | 0.13 | -0.08 | -1.11 | 1.03 |
| sj05 | SOA_050 | 30 | 30 | 24 | 14 | 0.80 | 0.47 | 0.84 | -0.08 | 0.93 |
| sj05 | SOA_170 | 30 | 30 | 14 | 9 | 0.47 | 0.30 | -0.08 | -0.52 | 0.44 |
| sj05 | SOA_220 | 30 | 30 | 11 | 12 | 0.37 | 0.40 | -0.34 | -0.25 | -0.09 |
| sj06 | SOA_050 | 30 | 30 | 20 | 12 | 0.67 | 0.40 | 0.43 | -0.25 | 0.68 |
| sj06 | SOA_170 | 30 | 30 | 0 | 1 | 0.00 | 0.03 | -Inf | -1.83 | -Inf |
| sj06 | SOA_220 | 30 | 30 | 0 | 2 | 0.00 | 0.07 | -Inf | -1.50 | -Inf |
| sj07 | SOA_050 | 30 | 30 | 14 | 9 | 0.47 | 0.30 | -0.08 | -0.52 | 0.44 |
| sj07 | SOA_170 | 30 | 30 | 15 | 15 | 0.50 | 0.50 | 0.00 | 0.00 | 0.00 |
| sj07 | SOA_220 | 30 | 30 | 15 | 9 | 0.50 | 0.30 | 0.00 | -0.52 | 0.52 |
| sj08 | SOA_050 | 30 | 30 | 13 | 9 | 0.43 | 0.30 | -0.17 | -0.52 | 0.36 |
| sj08 | SOA_170 | 30 | 30 | 11 | 13 | 0.37 | 0.43 | -0.34 | -0.17 | -0.17 |
| sj08 | SOA_220 | 30 | 30 | 8 | 7 | 0.27 | 0.23 | -0.62 | -0.73 | 0.10 |
| sj09 | SOA_050 | 30 | 30 | 11 | 11 | 0.37 | 0.37 | -0.34 | -0.34 | 0.00 |
| sj09 | SOA_170 | 30 | 30 | 18 | 18 | 0.60 | 0.60 | 0.25 | 0.25 | 0.00 |
| sj09 | SOA_220 | 30 | 30 | 22 | 13 | 0.73 | 0.43 | 0.62 | -0.17 | 0.79 |
| sj10 | SOA_050 | 30 | 30 | 22 | 15 | 0.73 | 0.50 | 0.62 | 0.00 | 0.62 |
| sj10 | SOA_170 | 30 | 30 | 13 | 9 | 0.43 | 0.30 | -0.17 | -0.52 | 0.36 |
| sj10 | SOA_220 | 30 | 30 | 11 | 13 | 0.37 | 0.43 | -0.34 | -0.17 | -0.17 |
| sj11 | SOA_050 | 30 | 30 | 9 | 5 | 0.30 | 0.17 | -0.52 | -0.97 | 0.44 |
| sj11 | SOA_170 | 30 | 30 | 7 | 4 | 0.23 | 0.13 | -0.73 | -1.11 | 0.38 |
| sj11 | SOA_220 | 30 | 30 | 9 | 5 | 0.30 | 0.17 | -0.52 | -0.97 | 0.44 |
| sj12 | SOA_050 | 30 | 30 | 10 | 5 | 0.33 | 0.17 | -0.43 | -0.97 | 0.54 |
| sj12 | SOA_170 | 30 | 30 | 4 | 5 | 0.13 | 0.17 | -1.11 | -0.97 | -0.14 |
| sj12 | SOA_220 | 30 | 30 | 7 | 3 | 0.23 | 0.10 | -0.73 | -1.28 | 0.55 |
| sj13 | SOA_050 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj13 | SOA_170 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj13 | SOA_220 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj14 | SOA_050 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj14 | SOA_170 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj14 | SOA_220 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj15 | SOA_050 | 30 | 30 | 15 | 4 | 0.50 | 0.13 | 0.00 | -1.11 | 1.11 |
| sj15 | SOA_170 | 30 | 30 | 16 | 4 | 0.53 | 0.13 | 0.08 | -1.11 | 1.19 |
| sj15 | SOA_220 | 30 | 30 | 7 | 0 | 0.23 | 0.00 | -0.73 | -Inf | Inf |
| sj16 | SOA_050 | 30 | 30 | 0 | 0 | 0.00 | 0.00 | -Inf | -Inf | NaN |
| sj16 | SOA_170 | 30 | 30 | 0 | 1 | 0.00 | 0.03 | -Inf | -1.83 | -Inf |
| sj16 | SOA_220 | 30 | 30 | 0 | 2 | 0.00 | 0.07 | -Inf | -1.50 | -Inf |
| sj17 | SOA_050 | 30 | 30 | 17 | 11 | 0.57 | 0.37 | 0.17 | -0.34 | 0.51 |
| sj17 | SOA_170 | 30 | 30 | 19 | 12 | 0.63 | 0.40 | 0.34 | -0.25 | 0.59 |
| sj17 | SOA_220 | 30 | 30 | 14 | 14 | 0.47 | 0.47 | -0.08 | -0.08 | 0.00 |
| sj18 | SOA_050 | 30 | 30 | 13 | 10 | 0.43 | 0.33 | -0.17 | -0.43 | 0.26 |
| sj18 | SOA_170 | 30 | 30 | 8 | 7 | 0.27 | 0.23 | -0.62 | -0.73 | 0.10 |
| sj18 | SOA_220 | 30 | 30 | 11 | 8 | 0.37 | 0.27 | -0.34 | -0.62 | 0.28 |
| sj19 | SOA_050 | 30 | 30 | 12 | 11 | 0.40 | 0.37 | -0.25 | -0.34 | 0.09 |
| sj19 | SOA_170 | 30 | 30 | 17 | 13 | 0.57 | 0.43 | 0.17 | -0.17 | 0.34 |
| sj19 | SOA_220 | 30 | 30 | 19 | 16 | 0.63 | 0.53 | 0.34 | 0.08 | 0.26 |
| sj20 | SOA_050 | 30 | 30 | 22 | 14 | 0.73 | 0.47 | 0.62 | -0.08 | 0.71 |
| sj20 | SOA_170 | 30 | 30 | 15 | 10 | 0.50 | 0.33 | 0.00 | -0.43 | 0.43 |
| sj20 | SOA_220 | 30 | 30 | 17 | 4 | 0.57 | 0.13 | 0.17 | -1.11 | 1.28 |
| sj21 | SOA_050 | 30 | 30 | 13 | 14 | 0.43 | 0.47 | -0.17 | -0.08 | -0.08 |
| sj21 | SOA_170 | 30 | 30 | 12 | 13 | 0.40 | 0.43 | -0.25 | -0.17 | -0.09 |
| sj21 | SOA_220 | 30 | 30 | 16 | 14 | 0.53 | 0.47 | 0.08 | -0.08 | 0.17 |
| sj22 | SOA_050 | 30 | 30 | 6 | 14 | 0.20 | 0.47 | -0.84 | -0.08 | -0.76 |
| sj22 | SOA_170 | 30 | 30 | 12 | 14 | 0.40 | 0.47 | -0.25 | -0.08 | -0.17 |
| sj22 | SOA_220 | 30 | 30 | 16 | 16 | 0.53 | 0.53 | 0.08 | 0.08 | 0.00 |
| sj23 | SOA_050 | 30 | 30 | 10 | 10 | 0.33 | 0.33 | -0.43 | -0.43 | 0.00 |
| sj23 | SOA_170 | 30 | 30 | 11 | 15 | 0.37 | 0.50 | -0.34 | 0.00 | -0.34 |
| sj23 | SOA_220 | 30 | 30 | 16 | 11 | 0.53 | 0.37 | 0.08 | -0.34 | 0.42 |
| sj24 | SOA_050 | 30 | 30 | 6 | 8 | 0.20 | 0.27 | -0.84 | -0.62 | -0.22 |
| sj24 | SOA_170 | 30 | 30 | 3 | 9 | 0.10 | 0.30 | -1.28 | -0.52 | -0.76 |
| sj24 | SOA_220 | 30 | 30 | 9 | 4 | 0.30 | 0.13 | -0.52 | -1.11 | 0.59 |
| sj25 | SOA_050 | 30 | 30 | 10 | 4 | 0.33 | 0.13 | -0.43 | -1.11 | 0.68 |
| sj25 | SOA_170 | 30 | 30 | 11 | 4 | 0.37 | 0.13 | -0.34 | -1.11 | 0.77 |
| sj25 | SOA_220 | 30 | 30 | 9 | 6 | 0.30 | 0.20 | -0.52 | -0.84 | 0.32 |
| sj26 | SOA_050 | 30 | 30 | 27 | 9 | 0.90 | 0.30 | 1.28 | -0.52 | 1.81 |
| sj26 | SOA_170 | 30 | 30 | 10 | 3 | 0.33 | 0.10 | -0.43 | -1.28 | 0.85 |
| sj26 | SOA_220 | 30 | 30 | 7 | 2 | 0.23 | 0.07 | -0.73 | -1.50 | 0.77 |
| sj28 | SOA_050 | 30 | 30 | 21 | 15 | 0.70 | 0.50 | 0.52 | 0.00 | 0.52 |
| sj28 | SOA_170 | 30 | 30 | 5 | 3 | 0.17 | 0.10 | -0.97 | -1.28 | 0.31 |
| sj28 | SOA_220 | 30 | 30 | 7 | 0 | 0.23 | 0.00 | -0.73 | -Inf | Inf |
| sj29 | SOA_050 | 30 | 30 | 23 | 16 | 0.77 | 0.53 | 0.73 | 0.08 | 0.64 |
| sj29 | SOA_170 | 30 | 30 | 22 | 17 | 0.73 | 0.57 | 0.62 | 0.17 | 0.46 |
| sj29 | SOA_220 | 30 | 30 | 23 | 16 | 0.77 | 0.53 | 0.73 | 0.08 | 0.64 |
| sj30 | SOA_050 | 30 | 30 | 14 | 13 | 0.47 | 0.43 | -0.08 | -0.17 | 0.08 |
| sj30 | SOA_170 | 30 | 30 | 13 | 10 | 0.43 | 0.33 | -0.17 | -0.43 | 0.26 |
| sj30 | SOA_220 | 30 | 30 | 9 | 9 | 0.30 | 0.30 | -0.52 | -0.52 | 0.00 |
In order to have a valid d’ value, the accuracy must NOT be 0 or 1. If accuracy is 0 or 1, then d’ cannot be computed (in this case R output is “infinite”).
The following plot report accuracy across subject, SOA and prime type (letter vs. number). Some subject have accuracy equal to 1 (in the plot, the purple lines represent accuracy 0 and 1), and thus d’ cannot be computed.
plot_PVT <-
exp3_pdt_sj %>%
group_by(sj, SOA, prime_type) %>%
summarise(acc = mean(acc)) %>%
ungroup() %>%
ggplot(aes(x = acc, y = sj, colour = SOA, shape = prime_type)) +
geom_point(position = position_dodge(0.5, preserve = 'total')) +
coord_cartesian(xlim = c(0, 1)) +
geom_vline(xintercept = c(0, 1),
linetype = 'dashed',
color = 'purple',
size = 0.3)
#> `summarise()` has grouped output by 'sj', 'SOA'. You can override using the `.groups` argument.
ggplotly(plot_PVT)
The d’ can be computed in all SOA conditions only for the following subjects: 1, 2, 4, 5, 7, 8, 9, 10, 11, 12, 17, 18, 19, 20, 21, 22, 23, 24, 25, 26, 29, 30
# Check whether d' values is infinite or NA
sj_excluded <-
d_prime %>%
filter(is.infinite(d_prime) | is.na(d_prime)) %>%
pull(sj) %>%
unique()
# Subject excluded: sj03, sj06, sj13, sj14, sj15, sj16, sj28
sj_excluded
#> [1] "sj03" "sj06" "sj13" "sj14" "sj15" "sj16" "sj28"
# Subject selected: sj03, sj06, sj13, sj14, sj15, sj16, sj28
setdiff(unique(d_prime$sj), sj_excluded)
#> [1] "sj01" "sj02" "sj04" "sj05" "sj07" "sj08" "sj09" "sj10" "sj11" "sj12"
#> [11] "sj17" "sj18" "sj19" "sj20" "sj21" "sj22" "sj23" "sj24" "sj25" "sj26"
#> [21] "sj29" "sj30"
Select subjects with finite d’ values.
# exclude sj with infinite d'
d_prime_f <-
d_prime %>%
filter(!(sj %in% sj_excluded))
Statistics for d’
# Calculate mean d'
t_mean_d_prime <-
d_prime_f %>%
return_stats(., c('SOA'), DV = 'd_prime')
#> `summarise()` has grouped output by 'sj'. You can override using the `.groups` argument.
# Show the table with the statistics
t_mean_d_prime %>%
make_table('d prime statistics')
| SOA | N_sj | Mean | SD | SE |
|---|---|---|---|---|
| SOA_050 | 22 | 0.45 | 0.54 | 0.12 |
| SOA_170 | 22 | 0.21 | 0.42 | 0.09 |
| SOA_220 | 22 | 0.38 | 0.37 | 0.08 |
Plot d prime by SOA
d_prime_f %>%
ggplot(aes(x = SOA, y = d_prime, fill = SOA)) +
geom_flat_violin(aes(fill = SOA),
position = position_nudge(x = .1, y = 0),
adjust = 1.5,
trim = FALSE,
alpha = .5,
colour = NA) +
geom_point(aes(x = as.numeric(factor(SOA)) - .15, y = d_prime, colour = SOA),
position = position_jitter(width = .05),
size = 2,
shape = 20) +
geom_boxplot(aes(x = SOA, y = d_prime, fill = SOA),
outlier.shape = NA,
alpha = .5,
width = .1,
colour = "black") +
scale_colour_brewer(palette = "Dark2") +
scale_fill_brewer(palette = "Dark2") +
geom_hline(yintercept = 0,
linetype = 'dashed',
color = 'red',
size = 0.5)
Despite the masking, both accuracy and d’ show that participants could perceive the prime in SOA condition “SOA_050”.
ggarrange(plot_acc_soa)
ggsave(here('figures', 'exp3_PDT_acc.tiff'),
width = 4,
height = 3,
dpi = 150) # or dpi = 300
xfun::session_info()
#> R version 4.0.5 (2021-03-31)
#> Platform: x86_64-w64-mingw32/x64 (64-bit)
#> Running under: Windows 10 x64 (build 19044)
#>
#> Locale:
#> LC_COLLATE=English_United Kingdom.1252
#> LC_CTYPE=English_United Kingdom.1252
#> LC_MONETARY=English_United Kingdom.1252
#> LC_NUMERIC=C
#> LC_TIME=English_United Kingdom.1252
#>
#> Package version:
#> abind_1.4-5 askpass_1.1 assertthat_0.2.1
#> backports_1.2.1 base64enc_0.1.3 BayesFactor_0.9.12-4.2
#> BH_1.75.0.0 blob_1.2.1 boot_1.3.27
#> broom_0.7.6 bslib_0.2.4 callr_3.6.0
#> car_3.0-10 carData_3.0-4 cellranger_1.1.0
#> cli_2.4.0 clipr_0.7.1 coda_0.19-4
#> colorspace_2.0-0 compiler_4.0.5 conquer_1.0.2
#> contfrac_1.1.12 corrplot_0.84 cowplot_1.1.1
#> cpp11_0.2.7 crayon_1.4.1 crosstalk_1.1.1
#> curl_4.3 data.table_1.14.0 DBI_1.1.1
#> dbplyr_2.1.1 deSolve_1.28 digest_0.6.27
#> dplyr_1.0.5 dtplyr_1.1.0 ellipsis_0.3.1
#> elliptic_1.4.0 evaluate_0.14 fansi_0.4.2
#> farver_2.1.0 forcats_0.5.1 foreign_0.8-81
#> fs_1.5.0 gargle_1.1.0 generics_0.1.0
#> ggplot2_3.3.5 ggpubr_0.4.0 ggrepel_0.9.1
#> ggsci_2.9 ggsignif_0.6.1 glue_1.4.2
#> googledrive_1.0.1 googlesheets4_0.3.0 graphics_4.0.5
#> grDevices_4.0.5 grid_4.0.5 gridExtra_2.3
#> gtable_0.3.0 gtools_3.8.2 haven_2.3.1
#> here_1.0.1 highr_0.8 hms_1.0.0
#> htmltools_0.5.1.1 htmlwidgets_1.5.3 httr_1.4.2
#> hypergeo_1.2.13 ids_1.0.1 isoband_0.2.4
#> janitor_2.1.0 jquerylib_0.1.3 jsonlite_1.7.2
#> kableExtra_1.3.4 knitr_1.33 labeling_0.4.2
#> later_1.1.0.1 lattice_0.20-41 lazyeval_0.2.2
#> lifecycle_1.0.0 lme4_1.1.26 lubridate_1.7.10
#> magrittr_2.0.1 maptools_1.1.1 markdown_1.1
#> MASS_7.3.53.1 Matrix_1.3-2 MatrixModels_0.5-0
#> matrixStats_0.58.0 methods_4.0.5 mgcv_1.8.34
#> mime_0.10 minqa_1.2.4 modelr_0.1.8
#> munsell_0.5.0 mvtnorm_1.1-1 nlme_3.1.152
#> nloptr_1.2.2.2 nnet_7.3.15 numDeriv_2016.8.1.1
#> openssl_1.4.3 openxlsx_4.2.3 parallel_4.0.5
#> pbapply_1.4-3 pbkrtest_0.5.1 pillar_1.6.0
#> pkgconfig_2.0.3 plotly_4.9.3 plyr_1.8.6
#> polynom_1.4.0 prettyunits_1.1.1 processx_3.5.1
#> progress_1.2.2 promises_1.2.0.1 ps_1.6.0
#> purrr_0.3.4 quantreg_5.85 R6_2.5.0
#> rappdirs_0.3.3 RColorBrewer_1.1-2 Rcpp_1.0.6
#> RcppArmadillo_0.10.2.2.0 RcppEigen_0.3.3.9.1 readr_1.4.0
#> readxl_1.3.1 rematch_1.0.1 rematch2_2.1.2
#> reprex_2.0.0 rio_0.5.26 rlang_0.4.10
#> rmarkdown_2.7 rprojroot_2.0.2 rstatix_0.7.0
#> rstudioapi_0.13 rvest_1.0.0 sass_0.3.1
#> scales_1.1.1 selectr_0.4.2 snakecase_0.11.0
#> sp_1.4.5 SparseM_1.81 splines_4.0.5
#> statmod_1.4.35 stats_4.0.5 stringi_1.5.3
#> stringr_1.4.0 svglite_2.0.0 sys_3.4
#> systemfonts_1.0.2 tibble_3.1.0 tidyr_1.1.3
#> tidyselect_1.1.0 tidyverse_1.3.1 tinytex_0.31
#> tools_4.0.5 utf8_1.2.1 utils_4.0.5
#> uuid_0.1.4 vctrs_0.3.7 viridisLite_0.3.0
#> webshot_0.5.2 withr_2.4.1 xfun_0.22
#> xml2_1.3.2 yaml_2.2.1 zip_2.1.1